package com.example.backadmindemo.controller;

import com.example.backadmindemo.pojo.IObehave;
import com.example.backadmindemo.service.IObehaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class IObehaveController {
    @Autowired
    private IObehaveService iObehaveService;

    @GetMapping("/selectInBySql/{currentPage}/{pageSize}")
    public List<IObehave> selectInBySql(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize) {
        return iObehaveService.selectIn(currentPage, pageSize);
    }

    @GetMapping("/selectOutBySql/{currentPage}/{pageSize}")
    public List<IObehave> selectOutBySql(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize) {
        return iObehaveService.selectOut(currentPage, pageSize);
    }

    @GetMapping("/getInTotal")
    public Integer getInTotal() {
        return iObehaveService.getInTotal();
    }

    @GetMapping("/getOutTotal")
    public Integer getOutTotal() {
        return iObehaveService.getOutTotal();
    }
}
